package fields;

import game.Player;

public class Tax extends Field {

	private int taxAmount; 
	private int taxRate;
	private int tax;
	
	public Tax(int number, String name, int taxAmount) { //Konstrukt√∏r
		super(number, name);
		fieldValue=4;
		this.taxAmount = taxAmount; 
		taxRate = 10;
		tax=0;
	}
	
	//Metode til at bestemme hvilken type tax, der vil betales.
	public void setTax(int choice, Player p)
	{
		if (choice==1) tax = taxAmount;
		else tax=p.getAccount()/taxRate;
	}
	
	public void landOnField(Player sp) {
		if (sp.getChoice()==1)
		{
			tax=taxAmount;
			sp.withdraw(tax);
		} else if (sp.getChoice()==2){
			tax=(sp.getAccount()/taxRate);
			sp.withdraw(tax);
		}
	}
	
}
